﻿<UserControl x:Class="SLExtensions.Showcase.IsInVisualTree"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    >
    <StackPanel x:Name="LayoutRoot" Background="White">
        <TextBlock Text="Check if a control is in Application visual tree. Provide unload function through LayoutUpdated event"/>
        <Rectangle x:Name="rect" Fill="Red" Height="40" LayoutUpdated="rect_LayoutUpdated" />        
        <Button Content="Remove rect" Height="40" VerticalAlignment="Bottom" HorizontalAlignment="Center" Width="100" Click="Button_Click" x:Name="btn"  />
    </StackPanel>
</UserControl>
